#pragma once
#include <stdint.h>

class RawAllocator 
{
public:
    RawAllocator();
    ~RawAllocator();

    void* Alloc(size_t size);
    void* Realloc(void* ptr, size_t size);
    void  Free(void* ptr);

public:
    void* AllocTrack(size_t size,
                     const char* file,
                     const char* func,
                     uint32_t line);
    void* ReallocTrack(void* ptr,
                       size_t size,
                       const char* file,
                       const char* func,
                       uint32_t line);
    void  FreeTrack(void* ptr);
};

#ifdef CHECK_MEM_LEAK
#define  MallocBuf(SIZET)         AllocTrack(SIZET, __FILE__, __FUNCTION__, __LINE__)
#define  ReallocBuf(PTRT, SIZET)  ReallocTrack(PTRT, SIZET, __FILE__, __FUNCTION__, __LINE__)
#define  FreeBuf                  FreeTrack
#else
#define  MallocBuf(SIZET)         Alloc(SIZET)
#define  ReallocBuf(PTRT, SIZET)  Realloc(PTRT, SIZET)
#define  FreeBuf                  Free
#endif  // CHECK_MEM_LEAK
